package com.lxy.es.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author lixueyang
 * @since 2022/4/21 9:24
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@Document(indexName = "product")
public class Product {

    @Id
    private Long id;

    @Field(type = FieldType.Keyword)
    private String name;

    private String content;

    private BigDecimal width;

    private BigDecimal height;

    private Integer pubStatus;

    @Field(index = false, store = true, type = FieldType.Date,format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}
